package com.example.demo.controller;

import com.example.demo.bean.User;
import com.example.demo.service.PermissionService;
import com.example.demo.service.RoleService;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/User")
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("/index")
    public String index(){
        return  "this is text page";
    }
    @GetMapping("/noLogin")
    public String noLogin(){
        return  "请先登录";
    }
    @GetMapping("/select")
    public List<User> select() {
        List<User> all = userService.findAll();
        return  all;
    }

    @GetMapping("/delete")
    public String delete(){
        return  "delete success";
    }
    @GetMapping("/update")
    public String update(){
        return  "update success";
    }
    @GetMapping("/error")
    public String error(){
        return  "没有权限操作";
    }
}
